#include "MY_TreeComboBoxView.h"

MY_TreeComboBoxView::MY_TreeComboBoxView()
{

}
void MY_TreeComboBoxView::mousePressEvent(QMouseEvent *event)
{
  //获取当前索引
  auto curIndex = currentIndex();
  auto rect = this->visualRect(curIndex);
  auto buttonRect = QRect(rect.left() - 20, rect.top(), 20, rect.height());
  if (buttonRect.contains(event->pos()))
  {
    if (isExpanded(curIndex)){
        setExpanded(curIndex, false);
    }

    else{
        setExpanded(curIndex, true);
    }
    emit treeMousePressed( true );
  }
  else{
    emit treeMousePressed(false);
  }
}
